package cmarter.dev.controllers;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.core.Context;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import cmarter.dev.service.interfaces.JenkinsTriggerInterface;

@Controller
@RequestMapping(value = "sedctv-jenkins/trigger")
public class JenkinsTrigger {
	private static Logger LOGGER = LoggerFactory.getLogger(JenkinsTrigger.class);

	@Autowired
	private JenkinsTriggerInterface manager;
	

	public JenkinsTrigger() { 	}
	
	@RequestMapping(value = "/build", method = RequestMethod.GET)
	@ResponseBody
	public boolean triggerBuild(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestParam String branchName) {
		LOGGER.debug("Triggering: " + branchName);
		
		boolean result = true;
		
		
		return result;
	}

}
